BigDFT.Inputfiles module

Handling of the input options

This module contains the useful quantities to deal with the preparation and the usage of inputfiles for BigDFT code. The main object is the Inputfile class, which inherits from a python dictionary. Such inheritance is made possible by the internal representation of the BigDFT inputfile, which employs the YAML syntax. This means that there is a one-to-one correspondence between a python dictionary and a BigDFT inputfile.

class Inputfile(*args, **kwargs)[source]

The BigDFT inputfile.

Principal object needed to run a BigDFT calculation. Might be initialized either from a dictionary, a (yaml-compliant) filename path or a:py:class:~BigDFT.Logfiles.Logfile instance.

Note

Each of the actions of the module InputActions, which is defined on a generic dictionary, also corresponds to a method of of the Inputfile class, and it is applied to the class instance. Therefore also the first argument of the corresponding action is implicitly the class instance. For the remove() method, the action has to be invoked should come from the InputActions module.

Example

>>> import InputActions as A, Inputfiles as I
>>> inp=I.Inputfile()
>>> inp.set_hgrids(0.3) # equivalent to A.set_hgrids(inp,0.3)
>>> inp
{'dft': {'hgrids': 0.3}}
>>> inp.optimize_geometry() # equivalent to A.optimize_geometry(inp)
>>> inp
{'dft': {'hgrids': 0.3},'geopt': {'method': 'FIRE',
                                  'ncount_cluster_x': 50} }
# equivalent to A.remove(inp,A.optimize_geometry)
>>> inp.remove(A.optimize_geometry)
>>> inp
{'dft': {'hgrids': 0.3}}
# read an input from a yaml file
>>> inp = I.Inpufile.from_yaml('filename.yaml')
# exemple of input file from Logfile instance
>>> inp = I.Inputfile.from_log(log)
classmethod from_log(log, **kwargs)[source]

Create a Inputfile instance from the information in a Logfile class.

Parameters:
  • log (Logfile) – Logfile instance.

  • **kwargs – other arguments that have to be passed to the instantiation.

Returns:

the Inputfile instance.

Return type:

Inputfile

classmethod from_yaml(filename, **kwargs)[source]

Create a Inputfile instance from the information in a yaml file class.

Parameters:
  • filename (str) – Path of the yaml filename.

  • **kwargs – other arguments that have to be passed to the instantiation.

Returns:

the Inputfile instance.

Return type:

Inputfile

Warning

It is assumed that the yaml file contains one single document.